import axios from '@/libs/api.request.js'

//订单售后查询
export const zhifu = data =>{
  return axios.request({
    url: "/api/index/charge",
    method: "post",
    data:data
  })
};

// 订单预支付
export const insertOrderMaster = data =>{
  return axios.request({
    url: "/api/order/master/insertOrderMaster",
    method: "post",
    data:data
  })
}

// 订单详情
export const insertOrderDetail = data =>{
  return axios.request({
    url: "/api/order/master/insertOrderDetail",
    method: "post",
    data:data
  })
}

// 上传凭证照片
export const uploadVoucher = data =>{

  return axios.request({
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    url: "/api/order/master/uploadVoucher",
    method: "post",
    data : data
  })
}


//文件上传
export const uploadVoucherTwo = data =>{
  return axios.request({
    method:"post",
    url:"/api/order/master/uploadVoucherTwo",
    data:data,
  })
};



// 修改订单支付方式(微信支付)
export const updateOrderMethod = (orderId,paymentMethod,paymentMoney,productId,supplierId,orderStatus) =>{
  const data = {
    paymentMoney:paymentMoney,
    orderId:orderId,
    paymentMethod:paymentMethod,
    productId:productId,
    payTime:new Date(),
    orderStatus:orderStatus,
    supplierId:supplierId,
  }
  return axios.request({
    url: "/api/order/master/updateOrderMethod",
    method: "post",
    data:data,
  })
}


// 修改拼团一订单支付方式
export const updateOrderMethodptyi = (orderId,paymentMethod,paymentMoney,productId,supplierId) =>{
  const data = {
    paymentMoney:paymentMoney,
    orderId:orderId,
    paymentMethod:paymentMethod,
    productId:productId,
    payTime:new Date(),
    orderStatus:9,
    supplierId:supplierId,
  }
  return axios.request({
    url: "/api/order/master/updateOrderMethodtwo",
    method: "post",
    data:data,
  })
}

export const updateOrderMethodone = (orderId,paymentMethod,paymentMoney,productId,supplierId) =>{
  const data = {
    paymentMoney:paymentMoney,
    orderId:orderId,
    paymentMethod:paymentMethod,
    productId:productId,
    payTime:new Date(),
    orderStatus:2,
    supplierId:supplierId,
  }
  return axios.request({
    url: "/api/order/master/updateOrderMethodtwo",
    method: "post",
    data:data,
  })
}



// 添加订单凭证
export const insertOrderVoucher = (orderId,filePath) =>{
  const data = {
    orderMasterId:orderId,
    orderVoucherUrl:filePath,
  }

  return axios.request({
    url: "/api/order/master/insertOrderVoucher",
    method: "post",
    data:data
  })
}

//微信支付
export const weiXinZhiFu = (data) =>{
  return axios.request({
    url: "/api/order/master/weiXinZhi",
    method: "post",
    data:data
  })
}

// 微信支付
export const getWeiXinPay = (totalPrice) =>{
  const data = {
    paymentMoney:totalPrice
  }
  return axios.request({
    url: "/api/wxPayTest/orders_other",
    method: "post",
    data:data
  })
};

// 微信支付
export const ordersOtherTwo = (totalPrice) =>{
  const data = {
    paymentOne:totalPrice
  }
  return axios.request({
    url: "/api/wxPayTest/ordersOtherTwo",
    method: "post",
    data:data
  })
};



//微信分享
export const getSignature = (data) =>{
  return axios.request({
    url: "/api/wshare/getSignature",
    method: "get",
    data: data
  })
}
